Buffering and replicating data written to a distributed storage system

ABSTRACT

Embodiments of the invention relate to small write performance enhancements for parallel file systems. One embodiment includes flushing a received write transaction from a first memory device to a second memory device on a node in a file system based on one or more byte-ranges within a file system block. It is determined to flush the received write transaction to a recovery log that is stored in a non-volatile storage layer of the file system. If it is determined to flush the received write transaction to the recovery log: appending data associated with the received write transaction in the recovery log of the file system, replicating the data associated with the received write transaction in another non-volatile storage layer of another node if required, and marking the one or more byte-ranges as committed.

BACKGROUND

Embodiments of the invention relate to buffering and data replication and, in particular, buffering and replicating data in a distributed file system.

Numerous workloads, such as virtual machines (VMs), databases, and accesses to user home directories, send small and synchronous write operations to storage. In addition, many small writes to a file system actually translate into many more small writes to the storage layer to update the recovery log and various metadata structures. Storage controllers typically use non-volatile read and write memory (NVRAM) to buffer these small writes and reduce their latency, but many systems, for example, systems based on a software-defined storage architecture, cannot install such expensive storage devices in every node. This is a particular problem for spinning disk-only based systems because of their poor performance for such operations. While storing data on large numbers of solid-state drives (SSDs) in every server can improve the situation, it is very costly given the typical capacity requirements in modern data centers. In addition, naively using SSDs to buffer random writes can severely degrade the lifetime of SSDs.

BRIEF SUMMARY

Embodiments of the invention relate to small write performance enhancements for parallel file systems. One embodiment includes a method that includes flushing a received write transaction from a first memory device to a second memory device on a node in a file system based on one or more byte-ranges within a file system block. In one embodiment, it is determined to flush the received write transaction to a recovery log that is stored in a non-volatile storage layer of the file system. In one embodiment, if it is determined to flush the received write transaction to the recovery log, data associated with the received write transaction is appended to the recovery log. If required, the data associated with the received write transaction is replicated in another non-volatile storage layer of another node, and the one or more byte-ranges are marked as committed.

These and other features, aspects and advantages of the present invention will become understood with reference to the following description, appended claims and accompanying figures.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 is a block diagram illustrating an example of a network environment for small write performance enhancements for parallel file systems, according to an embodiment of the present invention;

FIG. 2 is a block diagram illustrating an example of a server including a system utilizing buffering and replicating data written to a distributed storage system, according to an embodiment of the present invention, as shown in FIG. 1;

FIG. 3 illustrates a block diagram of an example server for buffering and replicating data written to a distributed storage system, in accordance with an embodiment of the invention;

FIG. 4 illustrates an example high-level view of a distributed system for buffering and replicating data written to a distributed storage system, in accordance with an embodiment of the invention;

FIG. 5 illustrates an example buffer write data process, in accordance with an embodiment of the invention;

FIG. 6 illustrates an example system layer traversal, in accordance with an embodiment of the invention; and

FIG. 7 is a block diagram showing a process for buffering and replicating data written to a distributed storage system, in accordance with an embodiment of the invention.

DETAILED DESCRIPTION

Aspects of the present invention are described below with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products, according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.

FIG. 1 illustrates a network architecture 100, in accordance with one embodiment. As shown in FIG. 1, a plurality of remote networks 102 are provided, including a first remote network 104 and a second remote network 106. A gateway 101 may be coupled between the remote networks 102 and a proximate network 108. In the context of the present network architecture 100, the networks 104, 106 may each take any form including, but not limited to, a LAN, a WAN, such as the Internet, public switched telephone network (PSTN), internal telephone network, etc.

In use, the gateway 101 serves as an entrance point from the remote networks 102 to the proximate network 108. As such, the gateway 101 may function as a router, which is capable of directing a given packet of data that arrives at the gateway 101, and a switch, which furnishes the actual path in and out of the gateway 101 for a given packet.

Further included is at least one data server 114 coupled to the proximate network 108, which is accessible from the remote networks 102 via the gateway 101. It should be noted that the data server(s) 114 may include any type of computing device/groupware. Coupled to each data server 114 is a plurality of user devices 116. Such user devices 116 may include a desktop computer, laptop computer, handheld computer, printer, and/or any other type of logic-containing device. It should be noted that a user device 111 may also be directly coupled to any of the networks in some embodiments.

A peripheral 120 or series of peripherals 120, e.g., facsimile machines, printers, scanners, hard disk drives, networked and/or local storage units or systems, etc., may be coupled to one or more of the networks 104, 106, 108. It should be noted that databases and/or additional components may be utilized with, or integrated into, any type of network element coupled to the networks 104, 106, 108. In the context of the present description, a network element may refer to any component of a network.

According to some approaches, methods and systems described herein may be implemented with and/or on virtual systems and/or systems, which emulate one or more other systems, such as a UNIX system that emulates an IBM z/OS environment, a UNIX system that virtually hosts a MICROSOFT WINDOWS environment, a MICROSOFT WINDOWS system that emulates an IBM z/OS environment, etc. This virtualization and/or emulation may be enhanced through the use of VMWARE software in some embodiments.

In other examples, one or more networks 104, 106, 108, may represent a cluster of systems commonly referred to as a “cloud.” In cloud computing, shared resources, such as processing power, peripherals, software, data, servers, etc., are provided to any system in the cloud in an on-demand relationship, therefore allowing access and distribution of services across many computing systems. Cloud computing typically involves an Internet connection between the systems operating in the cloud, but other techniques of connecting the systems may also be used, as known in the art.

In one or more embodiments, the system 100 utilizes a process for buffering and replicating data has been added to a file system to improve the small write performance of both application updates and internal file system metadata updates by placing the data in NVRAM (such as flash-backed dual in-line memory module (DIMMs)) or SSDs, and then replicating the data on one or more servers (depending on reliability requirements). One or more embodiments reduce the latency of each update while not reducing the availability of the data under node failures. In one example, when the data are hardened (i.e., replicated as required), the file system gathers the data in memory into large chunks (if contiguous blocks are found) and flushes it to the storage layer. Once data is in its permanent location, the data may be cleared from NVRAM. In one embodiment, if upon a node failure data exists in the NVRAM that has not yet been flushed to its permanent location, then a recovery sequence executes that flushes the data to storage from one of the replicated copies in NVRAM. In one example, a virtual machine (VM) writing to storage was simulated by a benchmark that performed a random 8 KB write workload to a single 50 GB file. With the use of a 500 MB NVRAM, which is stored on consumer-grade SSDs locally and on a partner node for fault tolerance, the performance increases from ˜50 IOPS when writing directly to the spinning disks to ˜3,000 IOPS when using one or more embodiments. Using more threads will somewhat improve the performance to the disk subsystem, but the maximum throughput of writing to a disk subsystem is very limited. When more threads are used, the higher maximum write performance of SSDs may be fully exploited. With the use of more NVRAM and/or a faster storage medium, e.g., flash-backed DIMMs, the performance may be improved even further. In one embodiment, because of the typically small size of available non-volatile random-access memory (NVRAM) devices, only small writes are buffered. With SSDs the situation is somewhat different, much larger write sizes may be buffered but with lower performance gain. In one example, the file system buffers the data in a cyclical manner, transforming all incoming random requests into a series of synchronous sequential updates to increase performance and reduce SSD degradation.

FIG. 2 shows a representative hardware environment associated with a user device 116 and/or server 114 of FIG. 1, in accordance with one embodiment. In one example, a hardware configuration includes a workstation having a central processing unit 210, such as a microprocessor, and a number of other units interconnected via a system bus 212. The workstation shown in FIG. 2 may include a Random Access Memory (RAM) 214, Read Only Memory (ROM) 216, an I/O adapter 218 for connecting peripheral devices, such as disk storage units 220 to the bus 212, a user interface adapter 222 for connecting a keyboard 224, a mouse 226, a speaker 228, a microphone 232, and/or other user interface devices, such as a touch screen, a digital camera (not shown), etc., to the bus 212, communication adapter 234 for connecting the workstation to a communication network 235 (e.g., a data processing network) and a display adapter 236 for connecting the bus 212 to a display device 238.

In one example, the workstation may have resident thereon an operating system, such as the MICROSOFT WINDOWS Operating System (OS), a MAC OS, a UNIX OS, etc. It will be appreciated that other examples may also be implemented on platforms and operating systems other than those mentioned. Such other examples may include operating systems written using JAVA, XML, C, and/or C++ language, or other programming languages, along with an object oriented programming methodology. Object oriented programming (OOP), which has become increasingly used to develop complex applications, may also be used.

FIG. 3 shows a server 300 for buffering and replicating data for a file system to improve the small write performance of both application updates and internal file system metadata updates by placing the data in NVRAM or SSDs, and replicating the data on one or more servers (depending on reliability requirements). In one embodiment, server 300 comprises a storage module 310, a page pool module 320, a recovery log module 330, a threshold module 340 and a replication and buffering process 350. In one embodiment, server 300 may take advantage of NVRAM in file system client nodes to reduce the latency of small and synchronous writes using the replication and buffering process 350 that scales write performance with addition of file system (FS) (e.g., general parallel file system GPFS, etc.) client nodes, avoiding bottlenecks in small amount of NVRAM at the storage controller 440 (FIG. 4) level.

In one embodiment, the targeted workloads for using the replication and buffering process 350 include VMs, logging, etc. that includes small synchronous writes. Due to the size of the file system recovery log of the recovery log module 330 (which may be limited), in one embodiment bursts of small write requests are absorbed, and then are written back to system storage (e.g., network shared disk (NSD 425), redundant array of inexpensive disks (RAID) disk 450, FIG. 4) using the storage module 310 in the background. In one example embodiment, if the amount of small write requests remains excessive for a long period of time, the system (e.g., system 400) using the server 300 will enter a steady state where write requests may need to wait for the recovery log of the file system to be wrapped before new write requests may be logged using the recovery log module 330.

In one embodiment, logging data in the recovery log of the recovery log module 330 improves the efficiency of write requests to the back end storage system 400 (FIG. 4). In one embodiment, by logging write requests using the recovery log module 330, the replication and buffering process 350 allows small writes to be gathered into larger chunks in memory in the file system buffer pool module 320 before they are written back to the permanent storage of the system 400 (FIG. 4). This is especially beneficial when the back end storage system 400 lacks any sort of NVRAM to buffer small write requests. Additionally, when writing data having a byte-range (e.g., 0-255, −128 to 127, etc.) that has a size smaller than a full block to an unallocated storage block, the file system must first write zeroes to the entire block. In one example, this means that a 4K sized write can turn into a 1 MB sized write, significantly increasing the latency of small writes to the file system. In one embodiment, write logging avoids this increased latency by logging the fact that the block needs to be zeroed out, allowing one of either two things to occur that improve performance: either more writes occur to the block, avoiding the need to zero out the block at all, or, if no more writes to this block occur, then the full block may be written out to permanent storage in the background.

In one or more embodiments, placing the file system recovery log in NVRAM of client nodes (e.g., recovery log module 330 of server 300) improves performance in all configurations (since many metadata operations require updates to the recovery log). In one example, the maximum size of the recovery log is about 1 GB, whereas most NVRAM is rather small (e.g., 500 MB). Therefore, the write log threshold of the threshold module 340 may be kept at rather small values, such as 4K or 8K. In one embodiment, since there is only a single recovery log of the recovery log module 330, for each node (e.g., server 300) and file system, if there are too many applications having a burst of small writes, then the applications should be moved to use different file systems or be placed on separate nodes.

FIG. 4 illustrates an example high-level view of a distributed system 400 for buffering and replicating data written to the distributed storage system 400, in accordance with an embodiment of the invention. In one example embodiment, the system 400 includes multiple file system clients 410 that each may implement server 300, an Internet protocol (IP)/interface (INF) switch 420, NSDs 425, storage area network (SAN) switch 430, storage controller 440 and RAID disk 450. It should be noted that other components, number of components, etc. may be implemented in system 400 without changing the scope of the one or more embodiments. In one example embodiment, if NVRAM (e.g., recovery log module 330 of server 300) used in the nodes (e.g., file system clients 410) exceeds the amount in the storage controller (440) (since it could be installed in every node), then write logging using replication and buffering process 350 assists in reducing latency. In another embodiment, if the NVRAM available on the nodes (e.g., file system clients 410) or on the network (in some other node or server or appliance) has lower latency (from the perspective of the file system client) than the storage controller (440) then write logging using replication and buffering process 350 assists in reducing latency.

In one embodiment, for a system with internal magnetic disk in each client node, if NVRAM is available either on a set of client nodes or in a separate set of nodes, the use of write logging using one or more embodiments improves performance over the direct use of internal magnetic disks of each client node. In one embodiment, a storage system with a fast write log, such as RAID controller, may be employed, but typically, it is limited in the amount of NVRAM it supports, and the write path in this environment is very long. For example, it takes two hops to hit the NVAM in the storage controllers, increasing the write latency. In one embodiment, placing NVRAM in the file system client nodes will decrease latency and increase the scalability and performance of small writes.

In one example embodiment, the NVRAM configuration in file system client 410 may include flash-backed DIMMS, such as that which ships in the x-series M4, or SSDs installed on every file system node. In one embodiment, the file system client 410 and the recovery log (e.g., of recovery log module 330, FIG. 3) are replicated (and possibly striped) across nodes, ensuring that each datum is on two different nodes. In one example embodiment, all recovery logs for the entire system are stored on one or two (or more) fast flash-based storage system (which includes NVRAM inside of it). In another example embodiment, data is stored on disks, and metadata (which includes the recovery log) on SSDs.

In another embodiment, the recovery log is stored in a separate storage media from other metadata. In this embodiment, a system.log pool (the storage media on which the recovery logs are stored) is created and specified when the file system is created. In one embodiment, once the system.log pool is created, the file system recovery log will automatically be placed in the system.log pool. In one embodiment, the user may specify a different replication factor for the system.log pool, so recovery logs are stored with replication different from other metadata in the “system” pool (the storage media on which file system metadata and/or data are stored).

In one embodiment, setting the threshold by the threshold module 340 (FIG. 3) to any value>0 (which is the default) will enable write logging. In one or more embodiments, all application write requests smaller or equal to the threshold will be placed in the recovery log of the file system clients 410 and a response will be immediately returned to the application.

In one example embodiment, the amount of NVRAM usable by the recovery log on each file system client 410 may be 128 MB or more, with a recommended size of 1 GB. In one embodiment, with replication, the size needed for the recovery log is doubled. In one embodiment, the smallest amount that may be logged is dependent upon granularity at which the file system can track and record updates to file system data blocks. In one example, for a VM workload that requires a lot of 4 KB writes, it is necessary to make sure the file system can support this small amount.

In one embodiment, the recovery log of each file system client 410 is placed on fast storage, such as NVRAM (e.g., flash backed DIMM, etc.), SSD, or PCIe SSD card. The fast storage can then be located, for example, on each file system client 410, or an SSD box connected to the storage controller 440, or on SSDs in the storage controller 440. In one example, if the recovery log is stored on the file system client 410 nodes and requires protection from node failure, the recovery log is set to be replicated in fast storage of two or more client nodes. In one embodiment, the write log threshold is set to the largest write size to log (4K or 32K for example). In one example, at fsync time (which includes synchronous writes or asynchronous writes followed by an fsync call), the data is logged into the recovery log of the file system client 410 if the writes are less than a user specified threshold. The log is forced (which means it is placed on the physical storage device) to ensure that the data is hardened in the faster storage.

Data is never read out of the recovery log during normal operation (without any disk or node or other hardware failures), but kept in the buffer pool of the file system client 410 nodes, and written back to permanent storage at a later point in time by a writeback thread. In one embodiment, performance can be improved by having the writeback threads write most of the data in the buffer pool to permanent storage prior to the records being removed from the recovery log. If the data is still dirty in the page pool when the records need to be removed from the recovery log, then the data must be first flushed to permanent storage prior to the records being removed from the recovery log (which is performed by logwrap). Flush from page pool prior to cleaning records from recovery log ensures that incoming writes have room in the recovery log to place data, and incoming writes will not have to wait for space to be freed up. When writing the buffer (a file system block) out to permanent storage (writeback thread or logwrap), all dirty ranges in a file system block are written out to permanent storage.

In one embodiment, when logwrap occurs, the replication and buffering process 350 (FIG. 3) checks to determine, for a logged record, if the buffer still is dirty. If the buffer is still dirty, which means that a writeback thread has not already synchronized the data to permanent storage, then all dirty ranges for the buffer are written to permanent storage. In one example, if there are many write log records for a single file system block, then the first one will cause all dirty data for the file system block to be written to permanent storage, and the following write log records will be removed from the recovery log of the file system client 410 node with no further data to be written out to permanent storage. If a node fails, the file system 400 manager will run recovery, and write the data records logged in the recovery log to permanent storage (e.g., RAID disk 450).

In one embodiment, when dirty data is flushed from the page pool of the file system client 410 to permanent storage, the sizes of the dirty ranges within the buffer are checked for a policy, for example, to see if they are less than the threshold (e.g., the threshold may be dynamically set based on system/operator constraints, the threshold may be a predetermined size, etc.), dependent on available resources (e.g., recovery log memory available), etc. In one example, if any range is greater than the threshold, the buffer ranges are written out to permanent storage. Otherwise, each range is placed in the recovery log of the file system client 410. Many other ways could be used to determine if a dirty range should be placed in the log or written out to the permanent storage, including but not limited to: the amount of available space in the recovery log, the I/O workload characteristics (read/write ratio, i/o size, i/o pattern). In one embodiment, if another file system client 410 node needs to read the data that is dirty in another client's buffer pool, then the data will have been flushed to permanent storage first (e.g., NSD 425, RAID disk 450, etc.) so it may be read from the other file system client 410 node. This is to maintain POSIX file system semantics. Therefore, in one example embodiment, data is only logged if a FLUSH_FSYNC flag is set, which indicates that the dirty data in the page pool is to be written to permanent storage for reasons other than it is about to be read by another node.

Once a write transaction has been placed in the recovery log, before a response can be returned to the application to complete the transaction (if needed), the newly added records in the recovery log must be on the NVRAM device.

In one embodiment, once data has been logged, the dirty data in the page pool will be written out to permanent storage (from the page pool of the file system client 410) by either logwrap or by a write behind thread (based on a timer or some other mechanism).

If the data is not flushed to permanent storage via a writeback thread, then logwrap will write the data to permanent storage prior to removing the records from the recovery log. This is the sub-optimal case, since this may mean that space in the recovery log of the file system client 410 is limited and incoming write threads may need to wait on logwrap for available space. In one embodiment, only the ranges logged are written out to permanent storage, since that is what is required before the log records may be removed from the recovery log of the file system client 410.

In one embodiment, a writeDataLogThreshold configuration parameter has been added to the system 400. The writeDataLogThreshold specifies a value of the length of a write transaction byte-range. If the length of the write transaction byte-range is at or below this value, then the write transaction is placed in the recovery log. If the length of the write transaction byte-range is greater than the writeDataLogThreshold, then the data is not placed in the recovery log and it is written to permanent storage. In one embodiment, writeDataLogThreshold may be changed dynamically using the threshold module 340 (FIG. 3) while a file system of the system 400 is mounted. In one example, if the value is reduced, then write requests simply stop being logged. If the value is increased, then larger write requests will be logged. In another embodiment, the writeDataLogThreshold may be set per file system of the system 400. In one embodiment, if it is determined not to place the range in the recovery log, and the byte-range to check overlaps with a byte-range for the file system block that has already been placed in the non-volatile layer, then the system 400 writes all dirty byte-ranges for the file system block to primary storage and places a marker in the non-volatile layer indicating that all previous updates to the file system block are skipped upon recovery that occurs upon node failure.

In one embodiment, to track which ranges have been logged, a new type of dirty bit has been added referred to as “committed.” In one example, the committed bits track which ranges are in the recovery log, so that the same range is not logged again and again. In one embodiment, when a logged range, which has not yet experienced logwrap, is re-dirtied, the committed bits for that range are reset so the range will be re-logged.

In one embodiment, the ranges to log are the ones that are dirty, not yet marked committed, and less than the write log size threshold. In one embodiment, the ranges to log are determined by creating a new bit array that is the XOR of committed and dirty bits, and then AND with the dirty bits. In one example, any number of ranges in a single file system block may be logged at one time, as long as each one is less than the write log threshold.

Conventionally, the updates to the dirty and committed bits are synchronized by the fact that the caller has the file system block lock whenever changing them (or the buffer they describe). In one embodiment, with write data logging, additional coordination is required with logwrap to avoid corruption. In one example, while the read and write path use the file system block lock to synchronize with each other, logwrap cannot grab this lock or risk deadlock. In one embodiment, flags are created (used in a similar manner as mutexes) that do not conflict between a read and write path, but will conflict with logwrap.

The portable operating system interface (POSIX) standard does not specify the state of uncommitted changes to a file after a crash. For example, consider a conventional file system with a 4 k block size. Consider an application performing three 256 k writes, A, B, and C, that all overlap to some extent. Each write will dirty 64 pages, and some pages will be dirtied multiple times. The example conventional system makes no guarantees when and in which order these dirty pages are written back to permanent storage. Some of the pages might have been flushed before the write B arrived, some of the pages containing B might have been flushed before write C arrived, and some arbitrary subset of pages containing C might have been flushed before the machine crashed. As result, the file on permanent storage may have some arbitrary combination of pages containing A, B, and C. This is different if the application calls fsync between writing A, B, and C. For example, if fsync after writing B completes successfully, and the machine then crashes while writing C, one would expect that some of the pages to which B was written might contain C instead of B, but none of them should contain A instead of B.

In one example embodiment, consider the code decides to log A and C, but not B. After writing A and an fsync, A will be in the recovery log of file system client 410, but not on permanent storage. In one example, B is written, which “re-dirties” some buffers with data from B, and the subsequent fsync now needs to flush data buffers containing B. If it is decided not to log B and it is placed on permanent storage, it may be worrisome that if a failure occurs right after this second fsync returns, then log recovery will overwrite some of the new B's with old A's, which would be incorrect, if B is promised as stable according to POSIX semantics.

To resolve this problem, before the file system replies to the application indicating that B has been successfully placed in permanent storage, in one embodiment, a special record (a “done record”) is placed in the recovery log (and placed on NVRAM and possibly replicated) that will prevent log recovery from replaying the log records containing A. So, the file system may choose to either log B or flush the buffer to permanent storage and force the done record. That solves a correctness problem for writes that are too large to be logged, because it is always correct to flush without logging, provided the done record is forced. In one embodiment, the case where the new write (B) does not overlap previously logged updates (A), it would be allowed to flush without forcing a done record.

FIG. 5 illustrates an example buffer write data process 500, in accordance with an embodiment of the invention. In one embodiment, the process 500 starts at block 501. In one embodiment, in block 510 executing applications in a file system (e.g., system 400, FIG. 4) write data into the file system. In one embodiment, in block 511 the file system requests to Sync a file system (FS) block to the storage system, such as an NSD 425, RAID disk 450, etc. (acquire lock on FS block buffer). In one embodiment, in block 520 it is determined if the FLUSH_FSYNC flag is set. In one embodiment, if the FLUSH_FSYNC flag is set process 500 continues to block 530. If it is determined that the FLUSH_FSYNC flag is not set, process 500 continues to block 525 where it is determined to not log data, and write the data to the storage system. In one embodiment, after block 525, process 500 continues to block 550 and the process 500 ends.

In one embodiment, in block 530 process 500 finds all byte-ranges within a FS block that are dirty but not committed (using bit logic) that satisfy a predefined condition. In one embodiment, process 500 continues to block 535 where it is determined whether uncommitted dirty ranges exist and satisfy the condition. In one embodiment, if it is determined that dirty uncommitted ranges do not exist and do not satisfy the condition, process 500 continues to block 545 where data is not logged and is written to permanent storage. After block 545 (and before block 550), if byte-ranges overlap with a byte-range for the file system block that has already been placed in the non-volatile layer, then the system writes all dirty byte-ranges for the file system block to primary storage and places a marker in the non-volatile layer indicating that all previous updates to the file system block are skipped upon recovery that occurs upon node failure. In one embodiment, process 500 proceeds to block 550 and process 500 ends.

In one embodiment, if it is determined that dirty uncommitted ranges do exist, process 500 continues to block 536 where the process reserves enough space in the recovery log for all dirty ranges. In one embodiment, in block 537 process 500 acquires mutex to synchronize with logwrap. In one embodiment, in block 538 process 500 checks if ranges have changed (reduced due to logwrap). In one embodiment, in block 539 one or more records are created in the recovery log for each log range, tracking items such as disk address, sector size, inode number, file offset, and data size.

In one embodiment, in block 540 all dirty ranges are marked as ‘committed.’ In one embodiment, in block 541 process 500 releases mutex to synchronize with logwrap. In block 542, all log records are written out to persistent storage of the file system. In one embodiment, process 500 then proceeds to block 550 and ends.

In one embodiment, a special System.log pool is created in which to store file system recovery logs. In one example, inside of this pool, a log may be replicated if more than one failure group is provided. To store the log in the NVRAM of each file system client 410 (FIG. 4) node, an NSD is created of each NVRAM and added to this pool with a different failure group identification (ID). In one example, in this setup one of the copies of the recovery log may not be stored on the local node. In one embodiment, it takes approximately the same amount of time to replicate log records on two remote nodes as one local node and one remote node since input/output (I/O) occurs in parallel.

One or more embodiments provide for: correct synchronization of buffered data additions/deletions with an in-memory copy; correctly synchronize I/O operations from any node in the cluster to buffered data to avoid data corruption and adhere to POSIX semantics; proper (POSIX) ordering of metadata and data buffering and recovery; fully parallel buffering replication, flushing, and removal of data; support a replication factor of 1 to N (N being a positive integer); tracking of fine grained data writes and rewrites across user and kernel space (track data ranges that are valid, dirty, and buffered (committed)); support selective write buffering (e.g., size a write threshold); and support for sparse files (avoid the need to zero-out unwritten sections of a block while maintaining threshold).

FIG. 6 illustrates an example system layer traversal 600, in accordance with an embodiment of the invention. In one example, the system layer traversal includes multiple layers 630 where data traverses one way with the approximate one-way traversal times 611 at each layer. In the example, the round total round trip time is about 5 ms for 4 KB of data. In one example, the conventional/traditional GFPS system stores data at the traditional buffer layer 620 into the GFPS log. In one embodiment, the data is stored at reference 610 using the GFPS recovery log in a file system client 410 (FIG. 4) using a process, such as process 500, FIG. 5 or process 700, FIG. 7). As shown, the traditional layer 620 stores data at the storage controller layer 621 at about 2 ms., whereas one embodiment stores data at the FS buffer layer at about 50 μs.

FIG. 7 is a block diagram showing a process 700 for buffering and replicating data written to a distributed storage system, in accordance with an embodiment of the invention. In one embodiment, in block 710, a received write transaction is flushed from a first memory device (e.g., an NVRAM, recovery log of a file system client 410, FIG. 4) to a second memory device (e.g., NSD 425, RAID disk 450, primary storage device, etc.) on a node in a file system (e.g., system 400) based on one or more byte-ranges within a file system block. In one embodiment, in block 720, it is determined to flush the received write transaction to a recovery log that is stored in a non-volatile storage layer of the file system. In block 730, if it is determined to flush the received write transaction to the recovery log: in block 730 data associated with the received write transaction is appended in the recovery log. In one embodiment, in block 740 the data associated with the received write transaction is replicated in another non-volatile storage layer of another node if required (e.g., 0 or more nodes). In one embodiment, in block 750, the one or more byte-ranges are marked as committed.

In one embodiment, process 700 may further flush the received write transaction based on whether: an application has requested the flush, a timer has expired, for avoidance of data corruption or loss, and the data associated with the received write transaction must be placed on the secondary memory device to maintain proper POSIX semantics. In one embodiment, process 700 may include determining if a byte-range is to be placed in the recovery log based on whether the byte-range is not already marked as committed and a particular policy is met.

In one embodiment, process 700 may further include that if the application updates a byte-range of a file system block that at least a portion is marked as committed, clearing one or more committed markings on the byte-range of a new write transaction and marking the byte-range as dirty. In one embodiment, in process 700 the first memory device comprises a volatile memory device, and the second memory device comprises a primary storage device on the node of the file system.

In one embodiment, process 700 may further include if it is determined not to place the byte-range in the recovery log, and the byte-range overlaps with a byte-range for the file system block that has already been placed in the non-volatile storage layer, then writing all dirty byte-ranges for the file system block to the primary storage device and placing a marker in the non-volatile storage layer indicating that all previous updates to the file system block are skipped upon recovery that occurs upon node failure. In one embodiment, the process 700 may also include integrating a file system recovery log layer in the file system, wherein the file system includes a distributed non-volatile layer that buffers data committed to a stable storage on cluster nodes of the file system, flushing dirty data to the primary storage device one of periodically or in response to a file system or application request, and marking the data no longer dirty. In one embodiment, in response to memory or space pressure, or a timer expiring, process 700 may traverse the recovery log and mark logged data ranges as no longer committed based on: determining if logged data ranges are still dirty; if the logged data ranges are still dirty, flushing the logged data ranges to the primary storage device; marking the logged data ranges as no longer dirty; and removing the byte-range records from the recovery log.

In one embodiment, process 700 may include determining if a byte-range is to be placed in the recovery log if the byte-range is not already marked committed further comprises that the request to flush the data associated with the received write transaction was not in response to a read transaction for data in the recovery log on a file system node other than a node on which the data is dirty. In one embodiment, process 700 may also include upon node or file system failure, quiescing file system and flushing data requests from the recovery log that is stored in the distributed non-volatile storage layer into the primary storage device and then unquiescing the file system to ensure proper POSIX semantics. Upon loss of access to a copy of data in the distributed non-volatile storage layer that is on a different node than the node which is placing requests in the recovery log, re-replicating data to ensure correct number of copies.

As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, aspects of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the present invention may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc. or any suitable combination of the foregoing.

Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).

Aspects of the present invention are described below with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks

The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.

The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.

References in the claims to an element in the singular is not intended to mean “one and only” unless explicitly so stated, but rather “one or more.” All structural and functional equivalents to the elements of the above-described exemplary embodiment that are currently known or later come to be known to those of ordinary skill in the art are intended to be encompassed by the present claims. No claim element herein is to be construed under the provisions of 35 U.S.C. section 112, sixth paragraph, unless the element is expressly recited using the phrase “means for” or “step for.”

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of all means or step plus function elements in the claims below are intended to include any structure, material, or act for performing the function in combination with other claimed elements as specifically claimed. The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the invention. The embodiment was chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated. 

What is claimed is:
 1. A method comprising: storing one or more data updates in a non-volatile storage layer of a file system; determining an amount of latency of writing the one or more data updates to permanent storage; and reducing the amount of latency by: initiating replication of the one or more data updates on one or more servers, wherein each resulting replicated copy of each data update is maintained on the one or more servers; gathering the one or more data updates into one or more memory chunks in a buffer of the file system; flushing the buffer by writing the one or more memory chunks in the buffer to permanent storage; and in response to a failure of a node of the file system that involves a data update in the buffer that has not yet been flushed to the permanent storage, flushing a replicated copy of the data update maintained on the one or more servers to the permanent storage; wherein the one or more data updates comprises different types of metadata including at least one recovery log and at least one other type of metadata; wherein the at least one recovery log is stored on a first storage media of the file system that is separate from a second storage media of the file system that the at least one other type of metadata is stored on; and wherein the different types of metadata are replicated on the one or more servers in accordance with a plurality of replication factors that are specified for particular types of metadata, the plurality of replication factors include a first replication factor that is specified for the at least the at least one recovery log, and the plurality of replication factors further include a second replication factor that is different from the first replication factor and that is specified for the at least one other type of metadata, such that the at least one recovery log is replicated on the one or more servers in accordance with the first replication factor, and the at least one other type of metadata is replicated on the one or more servers in accordance with the second replication factor.
 2. The method of claim 1, further comprising: clearing the one or more data updates from the non-volatile storage layer of the file system in response to flushing the buffer.
 3. The method of claim 1, wherein each data update is one of an application update or a file system metadata update.
 4. The method of claim 1, further comprising: determining whether one or more byte-ranges within a block of the file system overlaps with one or more other byte-ranges within the block of the file system that has already been placed in the non-volatile storage layer of the file system; and in response to determining the one or more byte-ranges overlaps with the one or more other byte-ranges, writing all dirty byte-ranges within the block of the file system to the permanent storage and placing a marker in the non-volatile storage layer of the file system indicating that all previous data updates to the block of the file system are skipped upon a recovery sequence that occurs upon the failure of the node of the file system; wherein each byte-range within the block of the file system that is dirty, in the buffer, and not yet flushed to the permanent storage are logged in the at least one recovery log.
 5. The method of claim 1, wherein the one or more memory chunks comprise one or more contiguous memory blocks.
 6. The method of claim 1, further comprising: executing a recovery sequence comprising flushing one or more replicated copies of the one or more data updates maintained on the one or more servers to the permanent storage in response to the failure.
 7. A system comprising a computer processor, a non-transitory computer-readable hardware storage device, and program code embodied with the computer-readable hardware storage device for execution by the computer processor to implement a method comprising: storing one or more data updates in a non-volatile storage layer of a file system; determining an amount of latency of writing the one or more data updates to permanent storage; and reducing the amount of latency by: initiating replication of the one or more data updates on one or more servers, wherein each resulting replicated copy of each data update is maintained on the one or more servers; gathering the one or more data updates into one or more memory chunks in a buffer of the file system; flushing the buffer by writing the one or more memory chunks in the buffer to permanent storage; and in response to a failure of a node of the file system that involves a data update in the buffer that has not yet been flushed to the permanent storage, flushing a replicated copy of the data update maintained on the one or more servers to the permanent storage; wherein the one or more data updates comprises different types of metadata including at least one recovery log and at least one other type of metadata; wherein the at least one recovery log is stored on a first storage media of the file system that is separate from a second storage media of the file system that the at least one other type of metadata is stored on; and wherein the different types of metadata are replicated on the one or more servers in accordance with a plurality of replication factors that are specified for particular types of metadata, the plurality of replication factors include a first replication factor that is specified for the at least the at least one recovery log, and the plurality of replication factors further include a second replication factor that is different from the first replication factor and that is specified for the at least one other type of metadata, such that the at least one recovery log is replicated on the one or more servers in accordance with the first replication factor, and the at least one other type of metadata is replicated on the one or more servers in accordance with the second replication factor.
 8. The system of claim 7, wherein the method further comprises: clearing the one or more data updates from the non-volatile storage layer of the file system in response to flushing the buffer.
 9. The system of claim 7, wherein each data update is one of an application update or a file system metadata update.
 10. The system of claim 7, wherein the method further comprises: determining whether one or more byte-ranges within a block of the file system overlaps with one or more other byte-ranges within the block of the file system that has already been placed in the non-volatile storage layer of the file system; and in response to determining the one or more byte-ranges overlaps with the one or more other byte-ranges, writing all dirty byte-ranges within the block of the file system to the permanent storage and placing a marker in the non-volatile storage layer of the file system indicating that all previous data updates to the block of the file system are skipped upon a recovery sequence that occurs upon the failure of the node of the file system; wherein each byte-range within the block of the file system that is dirty, in the buffer, and not yet flushed to the permanent storage are logged in the at least one recovery log.
 11. The system of claim 7, wherein the one or more memory chunks comprise one or more contiguous memory blocks.
 12. The system of claim 7, wherein the method further comprises: executing a recovery sequence comprising flushing one or more replicated copies of the one or more data updates maintained on the one or more servers to the permanent storage in response to the failure.
 13. A computer program product comprising a non-transitory computer-readable hardware storage device having program code embodied therewith, the program code being executable by a computer to implement a method comprising: storing one or more data updates in a non-volatile storage layer of a file system; determining an amount of latency of writing the one or more data updates to permanent storage; and reducing the amount of latency by: initiating replication of the one or more data updates on one or more servers, wherein each resulting replicated copy of each data update is maintained on the one or more servers; gathering the one or more data updates into one or more memory chunks in a buffer of the file system; flushing the buffer by writing the one or more memory chunks in the buffer to permanent storage; and in response to a failure of a node of the file system that involves a data update in the buffer that has not yet been flushed to the permanent storage, flushing a replicated copy of the data update maintained on the one or more servers to the permanent storage; wherein the one or more data updates comprises different types of metadata including at least one recovery log and at least one other type of metadata; wherein the at least one recovery log is stored on a first storage media of the file system that is separate from a second storage media of the file system that the at least one other type of metadata is stored on; and wherein the different types of metadata are replicated on the one or more servers in accordance with a plurality of replication factors that are specified for particular types of metadata, the plurality of replication factors include a first replication factor that is specified for the at least the at least one recovery log, and the plurality of replication factors further include a second replication factor that is different from the first replication factor and that is specified for the at least one other type of metadata, such that the at least one recovery log is replicated on the one or more servers in accordance with the first replication factor, and the at least one other type of metadata is replicated on the one or more servers in accordance with the second replication factor.
 14. The computer program product of claim 13, wherein the method further comprises: clearing the one or more data updates from the non-volatile storage layer of the file computer program product in response to flushing the buffer.
 15. The computer program product of claim 13, wherein each data update is one of an application update or a file system metadata update.
 16. The computer program product of claim 13, wherein the method further comprises: determining whether one or more byte-ranges within a block of the file system overlaps with one or more other byte-ranges within the block of the file system that has already been placed in the non-volatile storage layer of the file system; and in response to determining the one or more byte-ranges overlaps with the one or more other byte-ranges, writing all dirty byte-ranges within the block of the file system to the permanent storage and placing a marker in the non-volatile storage layer of the file system indicating that all previous data updates to the block of the file system are skipped upon a recovery sequence that occurs upon the failure of the node of the file system; wherein each byte-range within the block of the file system that is dirty, in the buffer, and not yet flushed to the permanent storage are logged in the at least one recovery log.
 17. The computer program product of claim 13, wherein the one or more memory chunks comprise one or more contiguous memory blocks.
 18. The computer program product of claim 13, wherein the method further comprises: executing a recovery sequence comprising flushing one or more replicated copies of the one or more data updates maintained on the one or more servers to the permanent storage in response to the failure. 